package com.gxa.order.service;

import dto.ResultDTO;
import entity.MacOrder;
import entity.Member;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;
import org.springframework.web.bind.annotation.RequestBody;

@FeignClient("ticket-service")
public interface TicketService {

    @PostMapping("ticket/get/byMemberId")
    ResultDTO findByMemberId(Integer memberId);
    @PostMapping("user/get/byMember")
    ResultDTO findByMember(Member member);

    @PostMapping("ticket/get/flight")
    ResultDTO findAllByFlightId(@RequestBody List<MacOrder> list);

    /**
     * 根据机票id 查询机票是否存在
     * @param flightId
     * @return
     */
    @PostMapping("ticket/get/byFlightId")
    ResultDTO findByFlightId(@RequestBody Integer flightId);

    /**
     * 根据机票id 查询机票库存是否大于等于1 大于1就减1
     * @param flightId
     * @return
     */
    @PostMapping("ticket/get/count")
    ResultDTO selectCount(@RequestBody Integer flightId);
}
